<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en" class="app">
<head>  
  <meta charset="utf-8" />
  <title>身份审核</title>
  <meta name="description" content="app, web app, responsive, admin dashboard, admin, flat, flat ui, ui kit, off screen nav" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <link rel="stylesheet" href="${pageContext.request.contextPath}/js/jPlayer/jplayer.flat.css" type="text/css" />
  <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.css" type="text/css" />
  <link rel="stylesheet" href="${pageContext.request.contextPath}/css/animate.css" type="text/css" />
  <link rel="stylesheet" href="${pageContext.request.contextPath}/css/font-awesome.min.css" type="text/css" />
  <link rel="stylesheet" href="${pageContext.request.contextPath}/css/simple-line-icons.css" type="text/css" />
  <link rel="stylesheet" href="${pageContext.request.contextPath}/css/font.css" type="text/css" />
  <link rel="stylesheet" href="${pageContext.request.contextPath}/css/app.css" type="text/css" />

  <link rel="stylesheet" href="${pageContext.request.contextPath}/js/datepicker/datepicker.css" type="text/css" />
  <link rel="stylesheet" href="${pageContext.request.contextPath}/js/slider/slider.css" type="text/css" />
  <link rel="stylesheet" href="${pageContext.request.contextPath}/js/chosen/chosen.css" type="text/css" />
    <!--[if lt IE 9]>
    <script src="${pageContext.request.contextPath}/js/ie/html5shiv.js"></script>
    <script src="${pageContext.request.contextPath}/js/ie/respond.min.js"></script>
    <script src="${pageContext.request.contextPath}/js/ie/excanvas.js"></script>
  <![endif]-->
  <style>
    .myButton{
      margin-top: 50px;
      width: 60%;
      margin-left: 20%;
      height: 40px;
      font-size: 21px;
    }
  </style>
</head>
<body class="">

  <section class="vbox">
            <section class="scrollable wrapper">
              
              <div class="col-sm-offset-1 col-sm-10">
                <section class="panel panel-default">
                  <header class="panel-heading font-bold">审核信息</header>
                    <div class="panel-body">
                      <form class="form-horizontal " method="get">
                        <div class="form-group">
                          <label class="col-lg-2 control-label">用户名</label>
                          <div class="col-lg-8">
                            <input type="name" class="form-control" placeholder="Name" value="${applyUser.username}">
                          </div>
                          
                        </div>

                        <div class="line line-dashed b-b line-lg pull-in"></div>
                        <div class="form-group">
                          <label class="col-lg-2 control-label">邮箱</label>
                          <div class="col-lg-8">
                          <input type="email" class="form-control" placeholder="Email" value="${applyUser.mailAddress}">
                          </div>
                          
                        </div>

                        <div class="line line-dashed b-b line-lg pull-in"></div>
                        <div class="form-group">
                          <label class="col-lg-2 control-label">申请事项</label>
                          <div class="col-lg-8">
                            <c:choose>
                              <c:when test="${apply.role==0}">
                                <input type="name" class="form-control" value="申请身份为学生">
                              </c:when>
                              <c:otherwise>
                                <input type="name" class="form-control" value="申请身份为教师">
                              </c:otherwise>
                            </c:choose>

                     <%--       <label class="radio radio-inline">
                              <input type="radio" name="optionsRadios1" id="optionsRadios1" value="option1" checked disabled="disabled">
                              <!-- 主页中的角色不可改变-->
                              学生
                            </label>
                            <label class="radio radio-inline">
                              <input type="radio" name="optionsRadios2" id="optionsRadios2" value="option2" disabled="disabled">
                              老师
                            </label>--%>
                          </div>
                          
                        </div>

                        <div class="line line-dashed b-b line-lg pull-in"></div>
                        <div class="form-group">
                          <label class="col-lg-2 control-label">学校</label>
                          <div class="col-lg-8">
                            <input type="name" class="form-control" placeholder="School Name" value="${applyUser.schoolName}">
                          </div>
                        </div>

                        <div class="line line-dashed b-b line-lg pull-in"></div>
                        <div class="form-group">
                          <label class="col-lg-2 control-label">专业</label>
                          <div class="col-lg-8">
                            <input type="name" class="form-control" placeholder="Major Name" value="${applyUser.majorName}">
                          </div>
                        </div>

                        <div class="line line-dashed b-b line-lg pull-in"></div>
                        <div class="form-group">
                          <label class="col-lg-2 control-label">姓名</label>
                          <div class="col-lg-8">
                            <input type="name" class="form-control" placeholder="Actual Name" value="${applyUser.actualName}">
                          </div>
                        </div>

                        <div class="line line-dashed b-b line-lg pull-in"></div>
                        <div class="form-group">
                          <label class="col-lg-2 control-label">性别</label>
                          <div class="col-lg-8">
                            <c:choose>
                              <c:when test="${applyUser.sex}==0">
                                <label class="radio radio-inline">
                                  <input type="radio" name="optionsRadios3"  value="option3" checked disabled="disabled">
                                  女
                                </label>
                                <label class="radio radio-inline">
                                  <input type="radio" name="optionsRadios4"  value="option4" disabled="disabled">
                                  男
                                </label>
                              </c:when>
                              <c:otherwise>
                                <label class="radio radio-inline">
                                  <input type="radio" name="optionsRadios3" value="option3"  disabled="disabled">
                                  女
                                </label>
                                <label class="radio radio-inline">
                                  <input type="radio" name="optionsRadios4" value="option4" checked disabled="disabled">
                                  男
                                </label>
                              </c:otherwise>
                            </c:choose>

                          </div>
                        </div>

                        <div class="line line-dashed b-b line-lg pull-in"></div>
                        <div class="form-group">
                          <label class="col-lg-2 control-label">电话</label>
                          <div class="col-lg-8">
                            <input type="name" class="form-control" placeholder="Phone Number" value="${applyUser.phone}">
                          </div>
                          
                        </div>     
                    </form>
                  </div>
                </section>

                <section class="panel panel-default">
                  <header class="panel-heading font-bold">审核结果</header>
                    <div class="panel-body">
                      <form class="form-horizontal " method="get">
                        <div class="form-group">
                          <label class="col-lg-2 control-label">理由</label>
                          <div class="col-lg-8">
                            <input type="text-info" id="reason" class="form-control" placeholder="审核理由...">
                          </div>
                        </div>
                        <div class="form-group">
                              <div class="col-xs-6">
                                <button type="button" class="btn btn-danger myButton" id="no">不通过</button>
                                <%--<a href="javascript:;" class="btn btn-info btn-xs myButton" style="color:white;border-color: #f5e79e;background-color: #d9534f" id="refuse">拒绝</a>--%>
                              </div>

                              <div class="col-xs-6">
                                <button type="button" class="btn btn-success myButton" id="yes">通过</button>
                              </div>

                            </div>

                    </form>
                  </div>
                </section>
              </div>
             <input type="hidden" id="applyId" value="${apply.id}">
              <input type="hidden" id="userId" value="${applyUser.id}">
              <input type="hidden" id="role" value="${apply.role}">
            </section>
          </section>

  <script src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
  <!-- Bootstrap -->
  <script src="${pageContext.request.contextPath}/js/bootstrap.js"></script>
  <!-- App -->
  <script src="${pageContext.request.contextPath}/js/app.js"></script>

  <!-- datepicker -->
  <script src="${pageContext.request.contextPath}/js/datepicker/bootstrap-datepicker.js"></script>
  <!-- slider -->
  <script src="${pageContext.request.contextPath}/js/slider/bootstrap-slider.js"></script>
  <!-- file input -->  
  <script src="${pageContext.request.contextPath}/js/file-input/bootstrap-filestyle.min.js"></script>
  <!-- wysiwyg -->
  <script src="${pageContext.request.contextPath}/js/wysiwyg/jquery.hotkeys.js"></script>
  <script src="${pageContext.request.contextPath}/js/wysiwyg/bootstrap-wysiwyg.js"></script>
  <script src="${pageContext.request.contextPath}/js/wysiwyg/demo.js"></script>
  <!-- markdown -->
  <script src="${pageContext.request.contextPath}/js/markdown/epiceditor.min.js"></script>
  <script src="${pageContext.request.contextPath}/js/markdown/demo.js"></script>

  <script src="${pageContext.request.contextPath}/js/slimscroll/jquery.slimscroll.min.js"></script>
  <script src="${pageContext.request.contextPath}/js/app.plugin.js"></script>
  <script type="text/javascript" src="${pageContext.request.contextPath}/js/jPlayer/jquery.jplayer.min.js"></script>
  <script type="text/javascript" src="${pageContext.request.contextPath}/js/jPlayer/add-on/jplayer.playlist.min.js"></script>
  <script type="text/javascript" src="${pageContext.request.contextPath}/js/jPlayer/demo.js"></script>
  <script src="${pageContext.request.contextPath}/layer/layer.js"></script>
  <script>
    $("#yes").click(function () {
      review(2);
    });
    $("#no").click(function () {
      review(3);
    });
    function review(result) {
      var applyId=$("#applyId").val();
      var reason=$("#reason").val();
      var userId=$("#userId").val();
      var role=$("#role").val();

      if (reason=="" ){
        layer.msg('请输入审核理由！', {time: 3000, icon:5});
        return false;
      }
      var regInfo={
        id:applyId,
        reason:reason,
        result:result,
        userId:userId,
        role:role
      };
      $.ajax({
        contentType:"application/json",
        url:getRootPath()+"/apply/review",
        type:"post",
        dataType:"json",
        data:JSON.stringify(regInfo),
        success:function (data) {
          if (data.res==0){
            layer.msg(data.msg, {time: 3000, icon:2});
          }else {
            layer.msg(data.msg, {time: 3000, icon:6});
          }

        },
        error:function (error) {
          layer.msg('连接失败！', {time: 3000, icon:5});
        }

      });
    }
    function getRootPath() {
      var curWwwPath = window.document.location.href;
      var pathName = window.document.location.pathname;
      var pos = curWwwPath.indexOf(pathName);
      var localhostPaht = curWwwPath.substring(0, pos);
      var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
      return (localhostPaht + projectName);
    }
  </script>
</body>
</html>